//
//  BaseNavigationController.m
//  TextToImg
//
//  Created by Garenge on 2019/M/29.
//  Copyright © 2019 鹏鹏. All rights reserved.
//

#import "BaseNavigationController.h"

@interface BaseNavigationController ()

@end

@implementation BaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UINavigationBar *navigationBar = [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[self class]]];

    UIColor *themeColor = [UIColor darkTextColor];
    //设置导航栏背景颜色
    if (@available(iOS 15.0, *)) {
        UINavigationBarAppearance *appearence = [[UINavigationBarAppearance alloc] init];
        UIFont *font = [UIFont systemFontOfSize:17 weight:UIFontWeightBold];
        NSDictionary *dic = @{NSFontAttributeName:font,
                              NSForegroundColorAttributeName: themeColor};
        appearence.titleTextAttributes =dic;
        appearence.backgroundColor = UIColor.whiteColor;
        navigationBar.standardAppearance = appearence;
        navigationBar.scrollEdgeAppearance = appearence;
    } else {
        [navigationBar setBarTintColor:UIColor.whiteColor];
        UIFont *font = [UIFont systemFontOfSize:17 weight:UIFontWeightBold];
        NSDictionary *dic = @{NSFontAttributeName:font,
                              NSForegroundColorAttributeName: themeColor};
        navigationBar.titleTextAttributes =dic;
    }

    [navigationBar setTintColor:themeColor];
    navigationBar.translucent = NO; // 透明开
}

@end
